package com.xdtech.hotel.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.xdtech.core.model.BaseItem;
import com.xdtech.core.orm.utils.BeanUtils;
import com.xdtech.hotel.model.Card;
import com.xdtech.web.freemark.item.GridColumn;

/**
 * 
 * @author max.zheng
 * @create 2015-04-04 11:11:08
 * @since 1.0
 * @see
 */
public class CardItem extends BaseItem implements Serializable{
	private static final long serialVersionUID = 1L;
	private Long id;
	@GridColumn(title="卡类型",width=100)
	private String cardTypeName;
//	@GridColumn(title="卡类型",width=100)
	private String cardType;
	@GridColumn(title="卡号",width=100)
	private String cardNo;
	

	public void setId(Long id) {
		this.id = id;
	}
	public Long getId() {
		return id;
	}
	
	public void setCardNo(String cardNo) {
		this.cardNo = cardNo;
		addQuerys("cardNo", cardNo);
	}
	public String getCardNo() {
		return cardNo;
	}
	
	public String getCardType() {
		return cardType;
	}
	public void setCardType(String cardType) {
		this.cardType = cardType;
		addQuerys("cardType", cardType);
	}
	
	public String getCardTypeName()
	{
		return cardTypeName;
	}
	public void setCardTypeName(String cardTypeName)
	{
		this.cardTypeName = cardTypeName;
	}
	/**
	 * 根据model构建vo
	 * 
	 * @author max
	 * @return
	 */
	public static CardItem createItem(Card card) {
		CardItem cardItem = new CardItem();
		BeanUtils.copyProperties(cardItem, card);
		//自定义属性设置填充
		return cardItem;
	}
	/**
	 * 根据model集合创建vo集合
	 * 
	 * @author max
	 * @return
	 */
	public static List<CardItem> createItems(List<Card> cards) {
		List<CardItem> cardItems = new ArrayList<CardItem>();
		for (Card card : cards) {
			cardItems.add(createItem(card));
		}
		return cardItems;
	}
}
